import { ajaxPost } from '@/utils/ajax';
import { AxiosRequestConfig } from 'axios';
import { assign } from 'lodash';

export const getAnswer = (prompt: string, config?: AxiosRequestConfig) => ajaxPost(
  '/v1/chat/completions',
  {
    model: 'deepseek-ai/DeepSeek-V3',
    messages: [
      {
        role: 'user',
        content: prompt,
      },
    ]
  },
  assign(
    {
      baseURL: 'https://api.siliconflow.cn',
      headers: {
        Authorization: `Bearer sk-brlrrqzqnktlrawyeldordfmbivyqbyncesroildeeumnely`,
        'Content-Type': 'application/json',
      }
    },
    config
  )
);